package cn.itcast.demo.controller;

import cn.itcast.demo.pojo.User;
import cn.itcast.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: taft
 * @Date: 2018-12-9 11:46
 */
@RestController
@RequestMapping("yun9")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("users")
    public List<User> queryUsersByIds(@RequestParam("ids") List<Long> ids){

        List<User> userList = userService.queryUsersByIds(ids);

        if (userList != null) {
            return userList;
        }

        return null;
    }
}
